- /* sdcpi.cpp by K.Tsuru */
- // function ID 3523 DRADIX
- /*************
- constant pi
- In header "snmath.h" the function prototype is given below
- --------
- SDouble Pi(const SDouble* pi = NULL, SDouble (*pfCalcFunc)() = SNPi);
- --------
- Remade at version 2.30.
- **************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- static SDouble* pi = NULL; //keep in the static memory
- static uint piSize = 0;
-
- void PiFree(){ //free the memory of pi
- if(piSize == 0) return;
- delete pi; pi = NULL; piSize = 0;
- }
- uint PiSize() { return piSize; }
-
- SDouble Pi(const SDouble* userPi, SDouble (*pfCalcFunc)()){
- // "new" must been done here.
- if(pi == NULL) pi = new SDouble;
- uint curMaxSize = pi->MaxSize(); // current max size
- if( piSize < curMaxSize ){
- #if UsesSNConstantFile
- if(userPi == NULL){ //called by default argument
- int enough;
- /**********************************************************************************
- UpdateConstantFile() recursively calls this function Pi() via SetConstByFile()
- of which userE != NULL, then does not come here and processing below has been
- done.
- **********************************************************************************/
- enough = UpdateConstantFile(Pi_FILE, Pi, pfCalcFunc, curMaxSize);
- if(enough != NO_SNC_FILE) return *pi;
- }
- #endif
- pi->ShowMessage("Evaluating Pi() now.....");
- EntryConst(userPi, pi, pfCalcFunc, &piSize);
- pi->ShowMessage(" Finished.\n"); // ver. 2.17
-
- piSize = curMaxSize;
- }
- return *pi;
- }
sdcpi.cpp : last modifiled at 2017/07/15 15:52:56(1,497 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).